#include <iostream>
#include <list>

using namespace std;

/*
   合并排序列表
*/

int main()
{
    list<int> l1;
    l1.push_back(1);
    l1.push_back(2);
    l1.push_back(8);
    l1.push_back(4);
    l1.push_back(5);

    list<int> l2;
    l2.push_back(6);
    l2.push_back(7);
    l2.push_back(3);
    l2.push_back(9);
    l2.push_back(10);

    list<int>::iterator it;
    for (it = l1.begin(); it != l1.end(); it++)
    {
        cout << *it << " ";
    }

    cout << endl;

    // l1.merge(l1); // 合并排序的列表

    l1.merge(l2);

    for (auto x : l1)
    {
        cout << x << " ";
    }

    return 0;
}